package com.ruoyi.web.controller.oto;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.controller.common.CommonController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 后台-文件上传
 */
@CrossOrigin
@RestController
@RequestMapping("/adm/files")
public class FileController {
    @Autowired
    private CommonController commonController;
    /**
     * 单个文件上传
     * @param file
     * @return
     */
    @PostMapping("upload")
    public @ResponseBody AjaxResult<String> upload(MultipartFile file) throws Exception {
        return commonController.uploadFile(file);
    }

    /**
     * 多个文件上传
     * @param files
     * @return
     */
    @PostMapping("uploads")
    public @ResponseBody AjaxResult<String> uploads(List<MultipartFile> files) throws Exception {
        return commonController.uploadFiles(files);
    }

}
